--- id: TASK-009 title: Wrap selection in markdown formatting status: "\U0001F3C1 Done" assignee: [] created_date: '2026-06-29 16:26' updated_date: '2026-06-30 00:23' labels: - feature - release-1 dependencies: [] priority: medium ordinal: 9000 --- ## Description Release 1. With a selection, a shortcut wraps it: bold (**), italic (_), inline code (backtick), and link ([sel](|)). Toggle off if already wrapped. With no selection, insert the empty pair with the cursor between. Needs free keys (Ctrl+B is new-inbox; pick non-conflicting bindings, document them). Keep the markup-visible invariant (the markers are inserted into the buffer). ## Acceptance Criteria - [x] #1 Selection wraps in **/_/code/link via shortcuts; toggles off when already wrapped - [x] #2 No selection inserts the pair with the cursor inside - [x] #3 Bindings chosen to not clash with existing keys; documented ## Implementation Notes Impl editor inline-format ops (internal/editor/format.go): WrapBold/WrapItalic/WrapCode (symmetric toggle, markers inside or outside selection) + WrapLink ([sel]() cursor in parens, toggle off full link). No selection inserts empty pair, cursor between. Bound Alt+s(bold/strong) Alt+i(italic) Alt+c(code) Alt+k(link) — no clash with Alt+b/f/d or Ctrl set; routed via editor dispatch, single undo group (editKindOf structural). Documented in README Keys table. 10 TDD tests in format_test.go; full suite green. Added surround-on-type: with a selection, typing * _ ` [ ( { < " ' ~ wraps the selection (nests on repeat, *→**). Complements Alt+s/i/c/k. wrapPair+surroundSelection in format.go; dispatch routes it. 6 tests. (commit wvztmpxz)